<?php
namespace frontend\controllers;


use frontend\models\ArtForm;
use Yii;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\helpers\Url;
use yii\web\Controller;
use yii\web\Response;
use yii\base\ErrorException;
use yii\helpers\Html;
use common\widgets\file_upload\FileUpload;
use common\models\member\Member;
use common\models\category\Category;
use common\models\articles\Articles;
use common\models\art\Art;
use common\models\meeting\Meeting;
use yii\data\Pagination;
use yii\web\Request;

class HyfabuController extends Controller
{     
	public $layout = 'nomalpage';

	/**
	 * 会员发布内容页
	 */
	public function actionIndex($id){
		$article = Art::find()->where(['status'=>10,'id'=>$id])->asArray()->one();
		$articles = Yii::$app->db->createCommand("select * from art where status = 10 and id != $id LIMIT 5")->queryAll();
		return $this->render('index',[
			'article' =>$article,
			'articles' =>$articles,
		]);
	}


    /**
    * 会员发布列表
    */

  public function actionList(){
	  $list = Art::find()->where(['status'=>10]);
	  $count = $list->count();
	  $page = new Pagination(['totalCount' => $count, 'pageSize' => '20']);
	  $articles = $list->offset($page->offset)
		  ->limit($page->limit)
		  ->all();
	  return $this->render('list',[
			'articles'=>$articles,
		    'page' => $page,
	  ]);
  }



}